package com.ruoyi.system.service.impl;

import com.ruoyi.system.entity.SysUserManage;
import com.ruoyi.system.mapper.SysUserManageMapper;
import com.ruoyi.system.service.SysUserManageService;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;

import javax.annotation.Resource;
import java.util.List;

/**
 * (SysUserManage)表服务实现类
 *
 * @author makejava
 * @since 2022-12-01 16:47:39
 */
@Service("sysUserManageService")
public class SysUserManageServiceImpl implements SysUserManageService {
    @Resource
    private SysUserManageMapper sysUserManageMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public SysUserManage queryById(Integer id) {
        return this.sysUserManageMapper.queryById(id);
    }

    /**
     * 分页查询
     *
     * @param sysUserManage 筛选条件
     * @return 查询结果
     */
    @Override
    public List<SysUserManage> queryByPage(SysUserManage sysUserManage) {
        return this.sysUserManageMapper.queryAllByLimit(sysUserManage);
    }

    /**
     * 新增数据
     *
     * @param sysUserManage 实例对象
     * @return 实例对象
     */
    @Override
    public SysUserManage insert(SysUserManage sysUserManage) {
        this.sysUserManageMapper.insert(sysUserManage);
        return sysUserManage;
    }

    /**
     * 修改数据
     *
     * @param sysUserManage 实例对象
     * @return 实例对象
     */
    @Override
    public SysUserManage update(SysUserManage sysUserManage) {
        this.sysUserManageMapper.update(sysUserManage);
        return this.queryById(sysUserManage.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.sysUserManageMapper.deleteById(id) > 0;
    }
}
